Skip to content

refactor: display exact command name for -v option#169

Merged
ktro2828 merged 1 commit into
mainfrom
refactor/cli/version-callback
Aug 18, 2025
Merged

refactor: display exact command name for -v option#169
ktro2828 merged 1 commit into
mainfrom
refactor/cli/version-callback

Conversation

@ktro2828

@ktro2828 ktro2828 commented Aug 18, 2025

Copy link
Copy Markdown
Collaborator

What

This PR updates version_callback in order to display right command name.

Copilot AI review requested due to automatic review settings August 18, 2025 12:38
@github-actions github-actions Bot added the refactor Refactoring code or increasing performance label Aug 18, 2025
@github-actions

github-actions Bot commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2297 1562 68% 50% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 1d850d9 by action🐍

This comment was marked as outdated.

@ktro2828 ktro2828 force-pushed the refactor/cli/version-callback branch from a5a3b3a to 45f6988 Compare August 18, 2025 12:53
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
@ktro2828 ktro2828 force-pushed the refactor/cli/version-callback branch from 45f6988 to 1d850d9 Compare August 18, 2025 12:57
@ktro2828 ktro2828 requested a review from Copilot August 18, 2025 12:57
@ktro2828 ktro2828 changed the title refactor: use lambda function for version callback refactor: display exact command name for -v option Aug 18, 2025
@ktro2828 ktro2828 merged commit 32fce0e into main Aug 18, 2025
4 of 5 checks passed
@ktro2828 ktro2828 deleted the refactor/cli/version-callback branch August 18, 2025 12:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the version callback function to dynamically retrieve the application name instead of using a hardcoded value. The change replaces the hardcoded "t4viz" string with the current CLI context's application name.

  • Imports click module to access current context information
  • Replaces hardcoded application name with dynamic context-based name retrieval

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread t4_devkit/cli/version.py
ctx = click.get_current_context()
version = importlib.metadata.version("t4-devkit")
console.print(f"[bold green]t4viz[/bold green]: [cyan]{version}[/cyan]")
console.print(f"[bold green]{ctx.info_name}[/bold green]: [cyan]{version}[/cyan]")

Copilot AI Aug 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ctx.info_name attribute may be None in some contexts, which would result in displaying 'None' in the version output. Consider adding a fallback value or null check.

Suggested change
console.print(f"[bold green]{ctx.info_name}[/bold green]: [cyan]{version}[/cyan]")
info_name = ctx.info_name if ctx.info_name is not None else "t4-devkit"
console.print(f"[bold green]{info_name}[/bold green]: [cyan]{version}[/cyan]")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactoring code or increasing performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants